<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!doctype html>
<html lang="zh-CN">
<head>
<style type="text/css">
#alertMsg {
    display: none;
    width: 400px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 1px 1px 10px black;
    padding: 10px;
    font-size: 12px;
    position: absolute;
    text-align: center;
    background: #fff;
    z-index: 100000;
}

#alertMsg_info {
    padding: 2px 15px;
    line-height: 1.6em;
    text-align: left;
}

#alertMsg_btn1, #alertMsg_btn2 {
    display: inline-block;
    background: url(images/gray_btn.png) no-repeat left top;
    padding-left: 3px;
    color: #000000;
    font-size: 12px;
    text-decoration: none;
    margin-right: 10px;
    cursor: pointer;
}

#alertMsg_btn1 cite, #alertMsg_btn2 cite {
    line-height: 24px;
    display: inline-block;
    padding: 0 13px 0 10px;
    background: url(images/gray_btn.png) no-repeat right top;
    font-style: normal;
}

</style>
<meta charset="utf-8">
<title>产品--未来财经旗下p2p网贷门户</title>
<meta name="keywords" content="网贷,P2P网贷,P2P理财,未来网贷">
<meta name="description" content="未来网贷未来财经旗下的P2P网贷理财行业门户网站，提供全方位、权威的网贷平台数据，是您身边的网贷资讯和P2P理财方面的专家,为您的网贷之路保驾护航">
<jsp:include page="/include/header.jsp"/>
<link rel="stylesheet" href="${basePath }/css/product.css"/>
<link rel="stylesheet" href="${basePath }/css/product_right.css"/>
<link rel="stylesheet" href="${basePath }/css/circlejindu.css"/>
<script type="text/javascript" src="${basePath }/js/jquery.cookies.2.2.0.js"></script>
<jsp:include page="/include/login.jsp"/>
<script type="text/javascript">
	$(function() {
		$('#keywords').blur(function() {
			var value = $(this).val();
			if(value=='') {
				$(this).val('请输入关键词');
				$(this).css('color', '#9C9A9C');
			}
		}).focus(function() {
			var value = $(this).val();
			if(value=='请输入关键词') 
				$(this).val('');
			$(this).css('color', '#000');
		})
		
		$("#open").find("a").click(function() {
			var clazz = $(this).attr("class");
			$(this).parent().children().removeAttr("class");
			if(clazz==''||clazz==null) {
				$(this).addClass("unlimit");
			} else if(clazz=='unlimit') {
				$(this).parent().children().first().addClass("unlimit");
			}
			var paramJson = getCondition();
			paramJson.pageNo = 1;
			$.ajax({
				url:"${basePath}/product/indexPage",
				type:"post",
				data:paramJson,
				dataType:"html"
			}).done(function(data){
				$(".leftlist_2").find(".leftlist_2_1_1").remove();
				$(".leftlist_2").find("form").after(data);
				initMore();
			})
		});
		
		$("#pop-dl").load("${basePath}/productList/pop");
		$("#hot-dl").load("${basePath}/productList/hot");
		
	})
	
	function pageMore() {
		var pageNo = Number($(".pageNumber").last().val())+1;
		var rows = $(".leftlist_2").find(".leftlist_2_1_1");
		var paramJson = getCondition();
		paramJson.pageNo = pageNo;
		$.ajax({
			url:"${basePath}/product/indexPage",
			type:"post",
			data:paramJson,
			dataType:"html"
		}).done(function(data){
			rows.last().after(data);
			initMore();
		})
	}
	
	function getCondition() {
		var level = $("#level-dd").find("a[class='unlimit']").attr("value");
		var year = $("#year-dd").find("a[class='unlimit']").attr("value");
		var date = $("#date-dd").find("a[class='unlimit']").attr("value");
		var from = $("#from-dd").find("a[class='unlimit']").attr("value");
		var paramJson = {};
		paramJson.level = level;
		paramJson.year = year;
		paramJson.date = date;
		paramJson.from = from;
		return paramJson;
	}
	
	function initMore() {
		$(".leftlist_2").find(".lookmore").show();
		$(".leftlist_2").find(".lookmore").next().show();
		var pageNumber = $(".pageNumber").last().val();
		var totalPage = $(".totalPage").last().val();
		if(pageNumber==totalPage) {
			$(".leftlist_2").find(".lookmore").hide();
			$(".leftlist_2").find(".lookmore").next().hide();
		}	
	}
	
	function searchProduct() {
		var paramJson = getCondition();
		var orderby = $("#orderby").val();
		var keywords = $("#keywords").val();
		if(keywords=='请输入关键词') keywords = '';
		paramJson.pageNo = 1;
		paramJson.orderby = orderby;
		paramJson.keywords = keywords;
		$.ajax({
			url:"${basePath}/product/indexPage",
			type:"post",
			data:paramJson,
			dataType:"html"
		}).done(function(data){
			$(".leftlist_2").find(".leftlist_2_1_1").remove();
			$(".leftlist_2").find("form").after(data);
			initMore();
		})
	}
</script>
<jsp:include page="/include/top.jsp"/>
<!--主体开始-->
<section>
	<div class="leftlist">
		<!--导航路径-->
	  	<div class="path">
	  		<a href="http://www.weilaiwd.com">位置：首页 >> </a>产品
	  	</div>
		<!--列表begin-->  
		<div class="leftlist_1">
			<dl id="open">
			    <dt>综合评级：</dt>
		    	<dd id="level-dd">
					<a href="javascript:;" target="_blank" class="unlimit" value="">不限</a> 
					<a href="javascript:;" target="_blank" value="0">1星</a>
					<a href="javascript:;" target="_blank" value="1">2星</a>
					<a href="javascript:;" target="_blank" value="2">3星</a>
					<a href="javascript:;" target="_blank" value="3">4星</a>
					<a href="javascript:;" target="_blank" value="4">5星</a>
				</dd>
				<dt>年化收益：</dt>
				<dd id="year-dd">
					<a href="javascript:;" target="_blank" class="unlimit" value="">不限</a>
					<a href="javascript:;" target="_blank" value="1">20%-16%</a>
					<a href="javascript:;" target="_blank" value="2">16%-12%</a>
					<a href="javascript:;" target="_blank" value="3">12%-8%</a>
					<a href="javascript:;" target="_blank" value="4">8%以下</a>
	     			</dd>
	     		<dt>投资期限：</dt>
		        <dd id="date-dd">
					<a href="javascript:;" target="_blank" class="unlimit" value="">不限</a> 
					<a href="javascript:;" target="_blank" value="1">30天以内</a>
					<a href="javascript:;" target="_blank" value="2">1-3个月</a>
					<a href="javascript:;" target="_blank" value="3">3-6个月</a>
					<a href="javascript:;" target="_blank" value="4">6-12个月</a>
					<a href="javascript:;" target="_blank" value="5">12个月以上</a>
		        </dd>
		        <dt>标的来源：</dt>
		        <dd id="from-dd">
					<a href="javascript:;" target="_blank" class="unlimit" value="">不限</a>
					<a href="javascript:;" target="_blank" value="">基石在线</a>
					<a href="javascript:;" target="_blank" value="">红岭创投</a>
					<a href="javascript:;" target="_blank" value="">银客网</a>
		        </dd>
	     	</dl>
   		</div>

	    <div class="leftlist_2">
			<form name="form" action="#" method="post">
				<div class="product_search">
					<span class="contrast"><label >产品列表</label></span>
					<span><label >排序： 
						<select id="orderby" class="sort" name="sort">
							<option value="">默认</option>
							<option value="1">投资期限</option>
							<option value="2">年收益率</option>
							<option value="3">借款金额</option>
						</select></label></span>
					<span><input class="keywords" id="keywords" type="text" value="请输入关键词" style="color:#9C9A9C;"> &nbsp;
					<input class="submit" name="submit" type="button" value="搜 索" onclick="searchProduct();"></span>
				</div>
			</form>
			<jsp:include page="list.jsp"/>
			<div class="lookmore"><a href="javascript:;" onclick="pageMore();"><img src="${basePath }/images/lookmore.png" ></a></div>
			<div class="clear"></div>
		</div>
	</div>


	<!--右侧栏begin-->
	<div class="rightlist">
	<!--广告242*170-->
    <div class="ad_242-170"><a href="${ad2.url }"><img src="${imgHost }${ad2.img }" ></a></div>
  	<!--人气产品-->
    <div class="list242">
		<h2><a href="javascript:;">人气产品</a></h2>
		<dl id="pop-dl">
			<dt><span>产品名称</span><span>完成度（%）</span></dt>
		</dl>
    </div>
  	<!--广告242*60-->
    <div class="ad_242-60"><a href="${ad3.url }"><img src="${imgHost }${ad3.img }" ></a></div>
	<!--热门平台-->
	<div class="list242">
		<h2><a href="javascript:;">热门平台</a></h2>
		<dl id="hot-dl">
			<dt><span>平台名称</span><span>年收益（%）</span></dt>
		</dl>
	</div>
  </div>
</section>
<jsp:include page="/include/footer.jsp"/>

<!--圆形进度条js-->
<script>

function test(platid,product_link){
	if(popLogin('')){
		var jr_auth= $.cookie("jr_auth"); 
		jr_auth = eval("("+jr_auth+")");
		$.ajax({
			   async:false,
			   url: 'http://api.weilaiwd.com:8085/binding/jump',
			   type: "GET",
			   dataType: 'jsonp',
			   jsonp: 'callback',
			   data: "user_id="+jr_auth.uid+"&platid="+platid+"&url="+product_link,
			   timeout: 5000,
			   beforeSend: function(){
			   //jsonp 方式此方法不被触发.原因可能是dataType如果指定为jsonp的话,就已经不是ajax事件了
			   },
			   success: function (json) {//客户端jquery预先定义好的callback函数,成功获取跨域服务器上的json数据后,会动态执行这个callback函数
				   if(json.code=="0")
				   alertMsg("<a href='"+json.url+"'>一键登陆</a>");
			   if(json.code=="2")
				   alertMsg("<a href='"+json.loginurl+"'>创建</a>&nbsp;&nbsp;&nbsp;<a href='"+json.bindurl+"'>绑定</a>");
			   if(json.code=="3")
				   alertMsg("<a href='http://www.weilaiwd.com/member/index.jspx'>请绑定手机或邮箱</a>");
			   },
			   error: function(xhr){
			    alert("请求出错(请检查相关度网络状况.)");
			   }
			});
	}
	
}




function alertMsg(msg, mode) { //mode为空，即只有一个确认按钮，mode为1时有确认和取消两个按钮
msg = msg || '';
mode = mode || 0;
var top = document.body.scrollTop || document.documentElement.scrollTop;
var isIe = (document.all) ? true : false;
var isIE6 = isIe && !window.XMLHttpRequest;
var sTop = document.documentElement.scrollTop || document.body.scrollTop;
var sLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
var winSize = function(){
    var xScroll, yScroll, windowWidth, windowHeight, pageWidth, pageHeight;
    // innerHeight获取的是可视窗口的高度，IE不支持此属性
    if (window.innerHeight && window.scrollMaxY) {
        xScroll = document.body.scrollWidth;
        yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }

    if (self.innerHeight) {    // all except Explorer
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }

    // for small pages with total height less then height of the viewport
    if (yScroll < windowHeight) {
        pageHeight = windowHeight;
    } else {
        pageHeight = yScroll;
    }

    // for small pages with total width less then width of the viewport
    if (xScroll < windowWidth) {
        pageWidth = windowWidth;
    } else {
        pageWidth = xScroll;
    }

    return{
        'pageWidth':pageWidth,
        'pageHeight':pageHeight,
        'windowWidth':windowWidth,
        'windowHeight':windowHeight
    }
}();
//alert(winSize.pageWidth);
//遮罩层
var styleStr = 'top:0;left:0;position:absolute;z-index:10000;background:#666;width:' + winSize.pageWidth + 'px;height:' +  (winSize.pageHeight + 30) + 'px;';
styleStr += (isIe) ? "filter:alpha(opacity=80);" : "opacity:0.8;"; //遮罩层DIV
var shadowDiv = document.createElement('div'); //添加阴影DIV
shadowDiv.style.cssText = styleStr; //添加样式
shadowDiv.id = "shadowDiv";
//如果是IE6则创建IFRAME遮罩SELECT
if (isIE6) {
    var maskIframe = document.createElement('iframe');
    maskIframe.style.cssText = 'width:' + winSize.pageWidth + 'px;height:' + (winSize.pageHeight + 30) + 'px;position:absolute;visibility:inherit;z-index:-1;filter:alpha(opacity=0);';
    maskIframe.frameborder = 0;
    maskIframe.src = "about:blank";
    shadowDiv.appendChild(maskIframe);
}
document.body.insertBefore(shadowDiv, document.body.firstChild); //遮罩层加入文档
//弹出框
var styleStr1 = 'display:block;position:fixed;_position:absolute;left:' + (winSize.windowWidth / 2 - 200) + 'px;top:' + (winSize.windowHeight / 2 - 150) + 'px;_top:' + (winSize.windowHeight / 2 + top - 150)+ 'px;'; //弹出框的位置
var alertBox = document.createElement('div');
alertBox.id = 'alertMsg';
alertBox.style.cssText = styleStr1;
//创建弹出框里面的内容P标签
var alertMsg_info = document.createElement('P');
alertMsg_info.id = 'alertMsg_info';
alertMsg_info.innerHTML = msg;
alertBox.appendChild(alertMsg_info);
//创建按钮
var btn1 = document.createElement('a');
btn1.id = 'alertMsg_btn1';
btn1.href = 'javas' + 'cript:void(0)';
btn1.innerHTML = '<cite>确定</cite>';
btn1.onclick = function () {
    document.body.removeChild(alertBox);
    document.body.removeChild(shadowDiv);
    return true;
};
alertBox.appendChild(btn1);
if (mode === 1) {
    var btn2 = document.createElement('a');
    btn2.id = 'alertMsg_btn2';
    btn2.href = 'javas' + 'cript:void(0)';
    btn2.innerHTML = '<cite>取消</cite>';
    btn2.onclick = function () {
        document.body.removeChild(alertBox);
        document.body.removeChild(shadowDiv);
        return false;
    };
    alertBox.appendChild(btn2);
}
document.body.appendChild(alertBox);

}
$(function() {
	$('.progressbar').each(function(index, el) {
		var num = $(this).find('span').text();
		$(this).addClass('progressbar-' + num);
	});
	
});
</script>
<!--圆形进度条js-->
